package com.foreknow.homework;

public class Rectangle {
    private int length;
    private int width;

    public int getLength() {
        return length;
    }

    public void setLength(int length) {
        this.length = length;
    }

    public int getWidth() {
        return width;
    }

    public void setWidth(int width) {
        this.width = width;
    }

    public Rectangle(){

    }

    public Rectangle(int width,int length){
        this.length=length;
        this.width=width;
    }

    /**
     * 求面积
     * @return
     */
    public int getArea(){
       int area =length*width;
       return area;
    }

    /**
     * 求周长
     */
    public int getPer(){
        int per=2*(length+width);
        return per;
    }

    /**
     * 显示
     */
    public void showAll(){
        System.out.println("矩形的长为："+length+",宽为："+width+
                "，面积为："+this.getArea()+"，周长为："+this.getPer());
    }

    public static void main(String[] args){
        Rectangle Rectangle=new Rectangle(5,6);
        Rectangle.showAll();
    }
}
